<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/commons/taglibs.jsp" %>
<%@ include file="/commons/script.jsp" %>
<script type="text/javascript" src="${ctx }/assets/js/pinyin_dict_notone.js"></script>
<script type="text/javascript" src="${ctx }/assets/js/pinyinUtil.js"></script>
<body>
<script>
jQuery(function($) {
	formvalidation("#addForm")
	$("#saveBtn").click(function(){
		$("#addForm").submit();
	})
	
	$("#menuName").blur(function(){	
			$("#menuCode").val(pinyinUtil.getPinyin($("#menuName").val()).replace(/\s+/g, ""));
	})
	
	
})
</script>
	<form:form action="${ctx }/menupopup/save" id="addForm" name="addForm" modelAttribute="sysMenu">
		<form:hidden path="id"/>
		<div class="form-group">
					<label class="control-label col-md-3"> <span class="required text-warning">*</span> <fmt:message
							key="SysMenu.parentId.title" />:
					</label>
				<div class="col-md-6">
					<form:select path="parent.id" cssClass="form-control" >
						<form:option value="">顶级菜单</form:option>
						<form:options items="${menuList }" itemLabel="menuName" itemValue="id" htmlEscape="true"/>
					</form:select>
				</div>
		</div>
		<div class="form-group">
					<label class="control-label col-md-3"> <span class="required text-warning">*</span> <fmt:message
							key="SysMenu.menuType.title" />:
					</label>
				<div class="col-md-6">
					<form:select path="menuType" class="form-control">
						<form:option value="1"><fmt:message key="SysMenu.menuType.system"></fmt:message></form:option>
						<form:option value="2"><fmt:message key="SysMenu.menuType.business"></fmt:message></form:option>
					</form:select>																						
				</div>
		</div>
		<div class="form-group">
					<label class="control-label col-md-3"> <span class="required">*</span> <fmt:message
							key="SysMenu.menuName.title" />:
					</label>
				<div class="col-md-6">
					<form:input path="menuName" cssClass="form-control required" maxlength="45" placeHolder="请输入菜单名称"/>
				</div>
		</div>
		<div class="form-group">
			
				<label class="control-label col-md-3"> <span class="required">*</span> <fmt:message
						key="SysMenu.menuCode.title" />:
				</label>					
				<div class="col-md-6">
					<form:input path="menuCode" cssClass="form-control required" maxlength="45" placeHolder="请输入菜单代码"/>
				</div>
			
		</div>
		<div class="form-group">
				<label class="control-label col-md-3"> <fmt:message
						key="SysMenu.menuUrl.title" />:
				</label>
				<div class="col-md-6">
					<form:input path="menuUrl" cssClass="form-control" maxlength="250" placeHolder="请输入链接地址"/>
				</div>
		</div>
		<div class="form-group">
				<label class="control-label col-md-3"> <fmt:message
						key="SysMenu.menuOrder.title" />:
				</label>
				<div class="col-md-6">
					<form:input path="menuOrder" cssClass="form-control required number {min : 1}"  placeHolder="请输入菜单排序"/>
				</div>
		</div>
		<div class="form-group">	
				<div class="col-md-6">
					<a id="saveBtn" class="btn btn-primary">保存</a>
					<a id="cancelBtn" class="btn btn-danger"  onclick="top.Dialog.close()">取消</a>
					
				</div>
		</div>
		<div id="afterupdate"></div>
	</form:form>
</body>
